ValueUnitPair

unit_system.ValueUnitPair()

Represents a value with associated units.

Attributes

value : float

The numerical value.

units : Unit

The units of the value.

Methods

Name Description
convert Return the value converted to the new units.
transform Return a new ValueUnitPair instance with the value converted to the new units.

convert

unit_system.ValueUnitPair.convert(new_units: TUnit)

Return the value converted to the new units.

Parameters

new_units : Unit

The new units.

Returns

converted_value : float

The converted value.

transform

unit_system.ValueUnitPair.transform(new_units: TUnit)

Return a new ValueUnitPair instance with the value converted to the new units.

Parameters

new_units : Unit

The new units.

Returns

value_unit_pair : ValueUnitPair

The new ValueUnitPair instance with the value converted to the new units and the new units.

Back to top